<?php
//4位随机颜色的随机字符
$str="0123456789abcdefghijklmnopqrstuvwxyz";
$str=str_shuffle($str);
//echo $str{0}.$str{1}.$str{2}.$str{3};//这样做，没有相同的
$char0=substr($str, mt_rand(0, strlen($str)-1),1);
$char1=substr($str, mt_rand(0, strlen($str)-1),1);
$char2=substr($str, mt_rand(0, strlen($str)-1),1);
$char3=substr($str, mt_rand(0, strlen($str)-1),1);
$char0 = "<span style='color:rgb(".mt_rand(0, 255).",".mt_rand(0, 255).",".mt_rand(0, 255).")'>$char0</span>";
$char1 = "<span style='color:rgb(".mt_rand(0, 255).",".mt_rand(0, 255).",".mt_rand(0, 255).")'>$char1</span>";
$char2 = "<span style='color:rgb(".mt_rand(0, 255).",".mt_rand(0, 255).",".mt_rand(0, 255).")'>$char2</span>";
$char3 = "<span style='color:rgb(".mt_rand(0, 255).",".mt_rand(0, 255).",".mt_rand(0, 255).")'>$char3</span>";
echo $char0.$char1.$char2.$char3;

?>